package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortPoint {
    public static void main(String[] args) {
        List<Point>List=new ArrayList<>();
        List.add(new Point(5,8));
        List.add(new Point(33,2344));
        List.add(new Point(21,52));
        List.add(new Point(45,6));
        List.add(new Point(55,65));
        List.add(new Point(1,2));
        System.out.println("原始数据为："+List);
        Collections.sort(List,(o1,o2)->o1.getX()-o2.getX());
    }
}
